package com.example.orderflow.config;

import com.example.orderflow.interceptor.CorsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册自定义的CORS拦截器
        registry.addInterceptor(new CorsInterceptor())
                .addPathPatterns("/**"); // 指定拦截器作用于所有路径
    }
}
